﻿var linkObj;

$(document).ready(function () {
    //alert("here");
    $("#editDialog").dialog({
        width: 800,
        modal: true,
        resizable: false,
        autoOpen: false,
        show: "blind",
        hide: "blind",
        closeOnEscape: true,
        modal: true
    });

    $("#cancelLink").click(function () {
        $("#editDialog").dialog('close');
    });

    $('#delete-dialog').dialog({
        autoOpen: false,
        resizable: false,
        modal: true,
        buttons: {
            "Continue": function () {
                $.post(linkObj[0].href,
                    function (data) {
                        if (data) {
                            linkObj.closest("tr").hide('fast'); //now hide the TR
                        }
                        else {
                            alert("There was an error deleting this record." + data);
                        }
                    });
                $(this).dialog("close");
            },
            "Cancel": function () {
                $(this).dialog("close");
            }
        }
    });

    $('.delete-link').click(function () {
        linkObj = $(this);
        $('#delete-dialog').dialog('open');
        return false;
    });

    //setupForm();

});


function OpenEditDialog() {
    $("#editDialog").dialog('open');
    setupForm();
    return false;
}

